#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
#include <QPushButton>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QPushButton* btn = new QPushButton("消息对话框",this);
    QMessageBox* mb = new QMessageBox(this);

    mb->setWindowTitle("警告");
    mb->setText("错误信息");
    mb->setIcon(QMessageBox::Question);
    mb->setStandardButtons(QMessageBox::Ok|QMessageBox::No|QMessageBox::Help);

    connect(btn,&QPushButton::clicked,[=]()
    {
        mb->show();
    });
}

MainWindow::~MainWindow()
{
    delete ui;
}

